<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>借钱贷</title>
    <link rel="stylesheet" type="text/css" href="./css/api.css" />
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <script src="./script/vue.min.js"></script>
    <style type="text/css">
    html,
    body {
        height: 100%;
    }

    #wrap {
        height: 100%;
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        -webkit-box-orient: vertical;
        -webkit-flex-flow: column;
        flex-flow: column;
    }
    #wrap div{
        width: 80%;
        margin: 20px 10%;
    }
    </style>
</head>

<body>
    <div id="wrap">
        <!-- <div style="margin-top:100px;" @click="goIndex1()" class="aui-btn aui-btn-primary">审核版2</div> -->
        <!-- <div  class="aui-btn aui-btn-success" @click="goIndex2()">正式版2</div> -->
    </div>
</body>
<script type="text/javascript" src="./script/api.js"></script>
<script type="text/javascript">
apiready = function() {
    init()
    api.refreshHeaderLoadDone()
    // 再点一次退出应用
    api.setStatusBarStyle({
        style: 'dark'
    });
    api.addEventListener({
        name: 'keyback'
    }, function(ret, err) {
        api.toast({
            msg: '再点一次退出应用',
            duration: 2000,
            location: 'bottom'
        });
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            api.closeWidget({
                silent: true
            });
        });
        setTimeout(function() {
            exitApp();
        }, 2000)
    });
    var vm = new Vue({
            el: '#wrap',
            data: {},
            methods: {
                goIndex1: function() {
                    api.closeWin();
                    api.openWin({
                        name: 'page1',
                        url: './html/audit/login.html'
                    });
                },
                goIndex2: function() {
                    api.closeWin();
                    api.openWin({
                        name: 'page2',
                        url: './html/online/home.html'
                    });
                }
            },
            mounted: function() {
              // api.openWin({
              //     name: 'page1',
              //     url: './html/audit/login.html',
                    // slidBackEnabled: false
              // });
              api.openWin({
                  name: 'page2',
                  url: './html/online/home.html',
                  slidBackEnabled: false
              });
            }
        })
};


function init() {
  api.addEventListener({
    name:'smartupdatefinish'
  }, function(ret, err){
    alert('更新完成');
    api.rebootApp();
  });
}



// 再点一次退出应用
function exitApp() {
    api.addEventListener({
        name: 'keyback'
    }, function(ret, err) {
        api.toast({
            msg: '再点一次退出应用',
            duration: 2000,
            location: 'bottom'
        });
        api.addEventListener({
            name: 'keyback'
        }, function(ret, err) {
            api.closeWidget({
                silent: true
            });
        });
        setTimeout(function() {
            exitApp();
        }, 2000)
    });
}
</script>

</html>
